
package com.neo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@ConfigurationProperties(prefix = "test") //将属性与配置文件中test开头的属性进行绑定
@Component   //bean对象加入IoC容器
public class TestConfiguration {
    private Long id;
    private String name;

    public void setId(Long id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Value("passwd")
    public void test(String passwd) {
        System.out.println(passwd);
    }
}
